package com.dyh.quickdemozwei.util;

import org.apache.http.client.HttpClient;

import java.util.Map;

import static com.dyh.quickdemozwei.util.HttpClinetCallKernel.getKernel;
import static com.dyh.quickdemozwei.util.HttpClinetCallKernel.postKernel;


/**
 * @Author: yhdong
 * @Date: 2021/12/1 16:40
 */
public class HttpClinetCallRecipes {




    public static String postNp(String url, HttpClient client, Map<String,Object> bodyMap
    ){
        return postKernel(url,client,null,bodyMap,HttpClinetCallKernel::map2NameValuePair);
    }

    public static String postNp(String url, HttpClient client, Map<String,String> headsMap, Map<String,Object> bodyMap
                             ){
        return postKernel(url,client,headsMap,bodyMap,HttpClinetCallKernel::map2NameValuePair);
    }

    public static String postJs(String url, HttpClient client, Map<String,String> headsMap, Map<String,Object> bodyMap){
        return postKernel(url,client,headsMap,bodyMap,HttpClinetCallKernel::map2Js);
    }

    public static String postJs(String url, HttpClient client, Map<String,Object> bodyMap){
        return postKernel(url,client,null,bodyMap,HttpClinetCallKernel::map2Js);
    }


    public static String get(String url, HttpClient client, Map<String,String> headsMap, Map<String,String> queryMap){
        return getKernel(url,client,headsMap,queryMap);
    }

    public static String get(String url, HttpClient client, Map<String,String> queryMap){
        return getKernel(url,client, null, queryMap);
    }




}
